package com.lixixi.tingshu.album;


import com.qcloud.vod.VodUploadClient;
import com.qcloud.vod.model.VodUploadRequest;
import com.qcloud.vod.model.VodUploadResponse;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class VodUploadExample {

	//  secret-key: AKID9HEyVowugFalrkPs9C1c2ECvSmtmRu9A
	//  access-key: rX0HMEtKXWKwKUSFporrgIguvjJitoX3
	//  storage-region: ap-guangzhou
	//  media-file-path:
	public static void main(String[] args) {
//		初始化一个上传客户端对象
//		使用云 API 密钥初始化 VodUploadClient 实例。
		VodUploadClient client = new VodUploadClient("secretId"
				, "secretKey");
//		构造上传请求对象
//		设置媒体本地上传路径。
		VodUploadRequest request = new VodUploadRequest();
		request.setMediaFilePath("FilePath");
//		调用上传
//		调用上传方法，传入接入点地域及上传请求。
		try {
			VodUploadResponse response = client.upload("ap-guangzhou", request);
			log.info("Upload FileId = {}", response.getFileId());
		} catch (Exception e) {
			// 业务方进行异常处理
			log.error("Upload Err", e);
		}
	}
}
